From: Keir Fraser Date: Fri, 17 Oct 2008 11:12:50 +0000 (+0100) Subject: svm: Check exitcode for NRIP validity only in debug builds. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14066^2~33 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=958646ea2e4ab4c1f3a78efd16bb961aabfe87b1;p=xen.git svm: Check exitcode for NRIP validity only in debug builds. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c index d09ce8dade..28b723fa0d 100644 --- a/xen/arch/x86/hvm/svm/emulate.c +++ b/xen/arch/x86/hvm/svm/emulate.c @@ -68,24 +68,25 @@ static unsigned long svm_nextrip_insn_length(struct vcpu *v) if ( !cpu_has_svm_nrips || (vmcb->nextrip <= vmcb->rip) ) return 0; +#ifndef NDEBUG switch ( vmcb->exitcode ) { case VMEXIT_CR0_READ... VMEXIT_DR15_WRITE: /* faults due to instruction intercepts */ /* (exitcodes 84-95) are reserved */ case VMEXIT_IDTR_READ ... VMEXIT_TR_WRITE: - case VMEXIT_RDTSC ... VMEXIT_SWINT: - case VMEXIT_INVD ... VMEXIT_INVLPGA: + case VMEXIT_RDTSC ... VMEXIT_MSR: case VMEXIT_VMRUN ... VMEXIT_MWAIT_CONDITIONAL: - case VMEXIT_IOIO: /* ...and the rest of the #VMEXITs */ case VMEXIT_CR0_SEL_WRITE: - case VMEXIT_MSR: case VMEXIT_EXCEPTION_BP: - return vmcb->nextrip - vmcb->rip; + break; + default: + BUG(); } - - return 0; +#endif + + return vmcb->nextrip - vmcb->rip; } /* First byte: Length. Following bytes: Opcode bytes. */